package com.chenfan.mcn.component.dict;

import com.chenfan.mcn.clients.baseinfo.BaseCustomerBillingVO;
import com.chenfan.mcn.clients.baseinfo.BaseInfoClient;
import com.chenfan.common.extension.context.SpringContextHolder;
import com.chenfan.common.extension.dict.DictTranslator;

/**
 * 客户开票抬头ID翻译成名称
 * @author wulg
 * @date 2021-12-11
 **/
public class CustomerBillingIdTranslator implements DictTranslator<Long, String> {

    @Override
    public String translate(Long customerBillingId) {
        BaseInfoClient baseInfoClient = SpringContextHolder.getBean(BaseInfoClient.class);
        BaseCustomerBillingVO baseCustomerBillingVO = baseInfoClient.getBillingsInfoById(customerBillingId).getObj();
        return baseCustomerBillingVO != null ? baseCustomerBillingVO.getInvoiceTitle() : customerBillingId.toString();
    }
}
